
// === uuMix.node ===
// depend: uuMeta
/*
HTMLElement.prototype.innerText
HTMLElement.prototype.outerHTML
 */
if (uuMeta.gecko && !HTMLElement.prototype.outerHTML) {
  (function(proto, inner, outer) {
    proto.__defineGetter__(inner, function() { // @return String:
      return this.textContent;
    });

    proto.__defineSetter__(inner, function(text) { // @param String:
      while (this.hasChildNodes()) {
        this.removeChild(this.lastChild);
      }
      this.appendChild(document.createTextNode(text));
    });

    proto.__defineGetter__(outer, function() { // @return String:
      var range = document.createRange(),
          div = document.createElement("div");

      range.selectNode(this);
      div.appendChild(range.cloneContents());
      return div.innerHTML;
    });

    proto.__defineSetter__(outer, function(html) { // @param String:
      var range = document.createRange(), cf;

      range.setStartBefore(this);
      cf = range.createContextualFragment(html);
      this.parentNode.replaceChild(cf, this);
    });
  })(HTMLElement.prototype, "innerText", "outerHTML");
}

